/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ccore.constraint.util;

import ccore.common.CElement;

import ccore.common.CNode;
import ccore.constraint.*;

import java.util.List;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

/**
 * <!-- begin-user-doc -->
 * The <b>Switch</b> for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object
 * and proceeding up the inheritance hierarchy
 * until a non-null result is returned,
 * which is the result of the switch.
 * <!-- end-user-doc -->
 * @see ccore.constraint.ConstraintPackage
 * @generated
 */
public class ConstraintSwitch<T> {
	/**
	 * The cached model package
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected static ConstraintPackage modelPackage;

	/**
	 * Creates an instance of the switch.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConstraintSwitch() {
		if (modelPackage == null) {
			modelPackage = ConstraintPackage.eINSTANCE;
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	public T doSwitch(EObject theEObject) {
		return doSwitch(theEObject.eClass(), theEObject);
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(EClass theEClass, EObject theEObject) {
		if (theEClass.eContainer() == modelPackage) {
			return doSwitch(theEClass.getClassifierID(), theEObject);
		}
		else {
			List<EClass> eSuperTypes = theEClass.getESuperTypes();
			return
				eSuperTypes.isEmpty() ?
					defaultCase(theEObject) :
					doSwitch(eSuperTypes.get(0), theEObject);
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(int classifierID, EObject theEObject) {
		switch (classifierID) {
			case ConstraintPackage.CCONSTRAINT_EXPR: {
				CConstraintExpr cConstraintExpr = (CConstraintExpr)theEObject;
				T result = caseCConstraintExpr(cConstraintExpr);
				if (result == null) result = caseCNode(cConstraintExpr);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.CINT_COMPARE: {
				CIntCompare cIntCompare = (CIntCompare)theEObject;
				T result = caseCIntCompare(cIntCompare);
				if (result == null) result = caseCConstraintExpr(cIntCompare);
				if (result == null) result = caseCNode(cIntCompare);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.CEQ: {
				CEq cEq = (CEq)theEObject;
				T result = caseCEq(cEq);
				if (result == null) result = caseCIntCompare(cEq);
				if (result == null) result = caseCConstraintExpr(cEq);
				if (result == null) result = caseCNode(cEq);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.CNEQ: {
				CNeq cNeq = (CNeq)theEObject;
				T result = caseCNeq(cNeq);
				if (result == null) result = caseCIntCompare(cNeq);
				if (result == null) result = caseCConstraintExpr(cNeq);
				if (result == null) result = caseCNode(cNeq);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.CLT: {
				CLt cLt = (CLt)theEObject;
				T result = caseCLt(cLt);
				if (result == null) result = caseCIntCompare(cLt);
				if (result == null) result = caseCConstraintExpr(cLt);
				if (result == null) result = caseCNode(cLt);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.CLEQ: {
				CLeq cLeq = (CLeq)theEObject;
				T result = caseCLeq(cLeq);
				if (result == null) result = caseCIntCompare(cLeq);
				if (result == null) result = caseCConstraintExpr(cLeq);
				if (result == null) result = caseCNode(cLeq);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.CLOGIC_CONSTRAINT: {
				CLogicConstraint cLogicConstraint = (CLogicConstraint)theEObject;
				T result = caseCLogicConstraint(cLogicConstraint);
				if (result == null) result = caseCConstraintExpr(cLogicConstraint);
				if (result == null) result = caseCNode(cLogicConstraint);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.CAND: {
				CAnd cAnd = (CAnd)theEObject;
				T result = caseCAnd(cAnd);
				if (result == null) result = caseCLogicConstraint(cAnd);
				if (result == null) result = caseCNConstraint(cAnd);
				if (result == null) result = caseCConstraintExpr(cAnd);
				if (result == null) result = caseCNode(cAnd);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.COR: {
				COr cOr = (COr)theEObject;
				T result = caseCOr(cOr);
				if (result == null) result = caseCLogicConstraint(cOr);
				if (result == null) result = caseCNConstraint(cOr);
				if (result == null) result = caseCConstraintExpr(cOr);
				if (result == null) result = caseCNode(cOr);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.CIMP: {
				CImp cImp = (CImp)theEObject;
				T result = caseCImp(cImp);
				if (result == null) result = caseCLogicConstraint(cImp);
				if (result == null) result = caseCTwoConstraint(cImp);
				if (result == null) result = caseCConstraintExpr(cImp);
				if (result == null) result = caseCNode(cImp);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.CNOT: {
				CNot cNot = (CNot)theEObject;
				T result = caseCNot(cNot);
				if (result == null) result = caseCLogicConstraint(cNot);
				if (result == null) result = caseCOneConstraint(cNot);
				if (result == null) result = caseCConstraintExpr(cNot);
				if (result == null) result = caseCNode(cNot);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.CN_CONSTRAINT: {
				CNConstraint cnConstraint = (CNConstraint)theEObject;
				T result = caseCNConstraint(cnConstraint);
				if (result == null) result = caseCConstraintExpr(cnConstraint);
				if (result == null) result = caseCNode(cnConstraint);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.CONE_CONSTRAINT: {
				COneConstraint cOneConstraint = (COneConstraint)theEObject;
				T result = caseCOneConstraint(cOneConstraint);
				if (result == null) result = caseCConstraintExpr(cOneConstraint);
				if (result == null) result = caseCNode(cOneConstraint);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.CCONSTRAINT: {
				CConstraint cConstraint = (CConstraint)theEObject;
				T result = caseCConstraint(cConstraint);
				if (result == null) result = caseCElement(cConstraint);
				if (result == null) result = caseCNode(cConstraint);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ConstraintPackage.CTWO_CONSTRAINT: {
				CTwoConstraint cTwoConstraint = (CTwoConstraint)theEObject;
				T result = caseCTwoConstraint(cTwoConstraint);
				if (result == null) result = caseCConstraintExpr(cTwoConstraint);
				if (result == null) result = caseCNode(cTwoConstraint);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			default: return defaultCase(theEObject);
		}
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CConstraint Expr</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CConstraint Expr</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCConstraintExpr(CConstraintExpr object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CInt Compare</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CInt Compare</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCIntCompare(CIntCompare object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CEq</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CEq</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCEq(CEq object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CNeq</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CNeq</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCNeq(CNeq object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CLt</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CLt</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCLt(CLt object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CLeq</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CLeq</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCLeq(CLeq object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CLogic Constraint</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CLogic Constraint</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCLogicConstraint(CLogicConstraint object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CAnd</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CAnd</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCAnd(CAnd object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>COr</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>COr</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCOr(COr object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CImp</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CImp</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCImp(CImp object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CNot</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CNot</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCNot(CNot object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CN Constraint</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CN Constraint</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCNConstraint(CNConstraint object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>COne Constraint</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>COne Constraint</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCOneConstraint(COneConstraint object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CConstraint</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CConstraint</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCConstraint(CConstraint object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CTwo Constraint</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CTwo Constraint</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCTwoConstraint(CTwoConstraint object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CNode</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CNode</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCNode(CNode object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CElement</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CElement</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCElement(CElement object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch, but this is the last case anyway.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
	 * @generated
	 */
	public T defaultCase(EObject object) {
		return null;
	}

} //ConstraintSwitch
